package com.practice.ajCollections010.set.hashset;

import java.util.ArrayList;
import java.util.HashSet;

/**
 * 移除元素
 */
public class RemoveElement {
    public static void main(String[] args) {
        HashSet<String> hashSet = new HashSet<>();
        for (int i = 0; i < 10; i++) {
            hashSet.add(Integer.toString(i));
        }

        hashSet.remove("1");

        ArrayList<String> list = new ArrayList<>();
        list.add("9");
        hashSet.removeAll(list);

        hashSet.forEach(item -> {
            System.out.println(item);
        });

        // 清空集合
        hashSet.clear();
    }
}
